/*账户总览-比赛主界面 path: '/gamemain*/
<template>
  <div id="game-main" class="game-main common-trade-trade">
    <header-account-top :tab="3"></header-account-top>
    <div class="game-top-blank"></div>
    <div class="game-main-overview">
      <div class="note">
        <div class="icon"><i class="iconfont icon-wocanjia"></i></div>
        我总共参加了 <span>{{gamesJoinNum}}场</span> 比赛
      </div>
      <div class="note">
        <div class="icon"><i class="iconfont icon-wochuangjian"></i></div>
        我总共创建了 <span>{{gamesCreateNum}}场</span> 比赛
      </div>
      <div class="to-selfaccount" @click.stop.prevent="toSelfAccount">个人账户总览</div>
      <div class="game-main-note">注：每场比赛都是单独的账户和本金， 需点击单场比赛后查看每场的收益和持仓</div>
    </div>
    <img src="~assets/images/trade/monijiaoyi.png" class="game-shuiyin">
    <games-list  :tab="'games-join'" ></games-list>
    <games-list  :tab="'games-create'"></games-list >
  </div>
</template>

<script>
  import Constant from 'common/constant'
  import LocalDAO from 'common/localDAO'
  import RemoteDAO from 'common/remoteDAO'
  import CommonUtil from 'common/common.util'
  import HeaderAccountTop from 'components/selfaccount/HeaderAccountTop'
  import GamesList from 'components/selfaccount/GamesList'

  export default {
    data () {
      return {
        userCode: LocalDAO.getUserCode(),
        gamesJoinNum: '--',
        gamesCreateNum: '--'
      }
    },
    created: function () {
      this.$root.eventHub.$on('getGamesJoinNum',(num) =>{
        this.gamesJoinNum =num
      })
      this.$root.eventHub.$on('getGamesCreateNum',(num) =>{
        this.gamesCreateNum =num
      })
    },
    components: {
      HeaderAccountTop,
      GamesList
    },
    methods: {
      toSelfAccount(){
        let kv = {"usercode":this.userCode}
        TDAPP.onEvent("21016","",kv)
        TDAPP.send()
        this.$router.push({path: '/selfaccount'})
      }
    }
  }
</script>

<style scoped>
  .game-main {
    width: 100%;
    background: #FFFFFF;
  }

  .game-top-blank {
    width: 100%;
    height: 44px;
    position: fixed;
    top: 0;
    background: #FD5400;
    z-index: 1038;
  }

  .game-main-overview {
    width: 100%;
    background: #FD5400;
    display: inline-block;
  }

  .game-main-overview div {
    color: #FFFFFF;
  }

  .game-main-overview .note {
    width: 100%;
    font-size: 14px;
    padding-left: 5.066%;
  }

  .game-main-overview .note:nth-child(1) {
    margin-top: 21px;
    margin-bottom: 7px;
  }

  .game-main-overview .note:nth-child(2) {
    margin-bottom: 30px;
  }

  .game-main-overview .note span {
    color: #FFFF54;
  }

  .game-main-overview .note .icon {
    border-radius: 50%;
    width: 24px;
    line-height: 24px;
    display: inline-block;
    background: #D13200;
    text-align: center;
    margin-right: 9px;
  }

  .game-main-overview .note .icon i {
    font-size: 15px;
  }

  .game-main-overview .to-selfaccount {
    width: 112px;
    height: 29px;
    line-height: 27px;
    font-size: 12px;
    border: 1px solid #FFBC80;
    background-color: rgba(205, 238, 255, 0.15);
    border-radius: 14px;
    margin-left: 5.066%;
    margin-right: 26px;
    float: left;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .game-main-overview .game-main-note {
    color: #ffd2c7;
    font-size: 11px;
    display: -webkit-box;
    text-align: left;
    margin-bottom: 30px;
  }

  .game-shuiyin {
    position: fixed;
    top: 19px;
    right: 0;
    z-index: 1039;
  }

</style>
